//
//  ACPaletteProvider.swift
//  ACFrameworkSwift
//
//  Created by c5342925 on 2022/3/31.
//

import Foundation

/**
  The palette of various theme.
 */
public protocol ACPaletteProvider {
    
    var colorDefinitions: [ACColorStyle: String] { get }
    
    func hexColor(style: ACColorStyle) -> UIColor?
    
}

extension ACPaletteProvider {
    
    public func hexColor(style: ACColorStyle) -> UIColor? {
        if let value = colorDefinitions[style] {
            return UIColor(hex: value)
        }
        return nil
    }
    
}

public struct LightTheme: ACPaletteProvider {
    
    public var colorDefinitions: [ACColorStyle : String] = [
        .primaryBackground: "FFFFFF",
        .primaryLabel: "223548",
        .teal2: "64EDD2",
        .primaryGroupedBackground: "840606",
        .secondaryLabel: "475E75",
        .indigo1: "F1ECFF",
        .green7: "97DD40",
        .grey3: "A9B4BE"
    ]
}

public struct DarkTheme: ACPaletteProvider {
    public var colorDefinitions: [ACColorStyle : String] = [
        .primaryBackground: "000000",
        .primaryLabel: "F5F6F7",
        .teal2: "02414C",
        .primaryGroupedBackground: "FF5C77",
        .secondaryLabel: "D5DADD",
        .indigo1: "1C0C6E",
        .green7: "1E592F",
        .grey3: "354A5F"
    ]
}
